import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/index.vue'
import Community from '../views/community/index.vue'
import Login from '../views/login/login.vue'
import Sports from '../views/product/sportsMoto/index.vue'
import Station from '../views/product/stationWagon/index.vue'
import Details from '../components/details/details.vue'

Vue.use(VueRouter)

const routes = [
	{
		path: '/',
		redirect: '/home'
	},
	{
		path: '/home',
		name: 'Home',
		component: Home
	},
	{
		path: '/sports',
		name: 'Sports',
		component: Sports
	},
	{
		path: '/station',
		name: 'Station',
		component: Station
	},
	{
		path: '/community',
		name: 'Community',
		component: Community
	},
	{
		path: '/login',
		name: 'Login',
		component: Login
	},
	{
		path: '/details',
		name: 'Details',
		component: Details
	},
]

const router = new VueRouter({
	mode: 'history',
	routes,
	scrollBehavior (to, from, savedPosition) {
	  if (savedPosition) {
	    return savedPosition
	  } else {
	    return { x: 0, y: 0 }
	  }
	}
})

export default router
